package com.cyz.controller;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/Index")
public class Index {
	
	@RequestMapping("/index")
	public ModelAndView index(HttpServletRequest request,HttpServletResponse response) {
		ModelAndView mv = new ModelAndView();
		List<String> list= new ArrayList<>();
		list.add("1");
		list.add("2");
		mv.addObject("list",list);
		mv.addObject("msg","hello springMVC");
		mv.setViewName("index");//Shopping/page/Index/index.jsp
		request.getSession().getAttribute("userName");
		request.getSession().setAttribute("userName",request.getParameter("userName"));
		if(true) {
			
		}
		request.getSession().setAttribute("nowPage","/Shopping/Index/index");
		return mv;
	}
	@RequestMapping("/a")
	public void a(HttpServletRequest request,HttpServletResponse response) {
		//dc=caosad
		request.getParameter("userName");
	}
	@RequestMapping("/")
	public String b() {
		return "redirect:/slds/";
	}
	
}
